home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / mail / pine3.96.tar.gz / pine3.96.tar / pine3.96 / pine / osdep / err_desc.hom < prev    next >
Text File  |  1993-07-15  |  3KB  |  79 lines

  1. /*----------------------------------------------------------------------
  2.    This is here in case errno on your system is so brain damaged that it's 
  3.  unusable. Hopefully it'll get very little use.
  4.  
  5.  
  6.     This routine maps error numbers to error names and error messages.
  7.     These are all directly ripped out of the include file errno.h, and
  8.     are HOPEFULLY standardized across the different breeds of Unix!!
  9.  
  10.     If (alas) yours are different, you should be able to use awk to
  11.     mangle your errno.h file quite simply...
  12.  
  13. **/
  14.  
  15. char *err_name[] = { 
  16. /* 0 */            "NOERROR", "No error status currently",
  17. /* 1 */        "EPERM",   "Not super-user",
  18. /* 2 */        "ENOENT",  "No such file or directory",
  19. /* 3 */        "ESRCH",   "No such process",
  20. /* 4 */        "EINTR",   "Interrupted system call",
  21. /* 5 */        "EIO",     "I/O error",
  22. /* 6 */        "ENXIO",   "No such device or address",
  23. /* 7 */        "E2BIG",   "Arg list too long",
  24. /* 8 */        "ENOEXEC", "Exec format error",
  25. /* 9 */        "EBADF",   "Bad file number",
  26. /* 10 */    "ECHILD",  "No children",
  27. /* 11 */    "EAGAIN",  "No more processes",
  28. /* 12 */    "ENOMEM",  "Not enough core",
  29. /* 13 */    "EACCES",  "Permission denied",
  30. /* 14 */    "EFAULT",  "Bad address",
  31. /* 15 */    "ENOTBLK", "Block device required",
  32. /* 16 */    "EBUSY",   "Mount device busy",
  33. /* 17 */    "EEXIST",  "File exists",
  34. /* 18 */    "EXDEV",   "Cross-device link",
  35. /* 19 */    "ENODEV",  "No such device",
  36. /* 20 */    "ENOTDIR", "Not a directory",
  37. /* 21 */    "EISDIR",  "Is a directory",
  38. /* 22 */    "EINVAL",  "Invalid argument",
  39. /* 23 */    "ENFILE",  "File table overflow",
  40. /* 24 */    "EMFILE",  "Too many open files",
  41. /* 25 */    "ENOTTY",  "Not a typewriter",
  42. /* 26 */    "ETXTBSY", "Text file busy",
  43. /* 27 */    "EFBIG",   "File too large",
  44. /* 28 */    "ENOSPC",  "No space left on device",
  45. /* 29 */    "ESPIPE",  "Illegal seek",
  46. /* 30 */    "EROFS",   "Read only file system",
  47. /* 31 */    "EMLINK",  "Too many links",
  48. /* 32 */    "EPIPE",   "Broken pipe",
  49. /* 33 */    "EDOM",    "Math arg out of domain of func",
  50. /* 34 */    "ERANGE",  "Math result not representable",
  51. /* 35 */    "ENOMSG",  "No message of desired type",
  52. /* 36 */    "EIDRM",   "Identifier removed"
  53.     };
  54. #endif
  55.  
  56.  
  57. /*----------------------------------------------------------------------
  58.        Return string describing the error
  59.  
  60.    Args: errnumber -- The system error number (errno)
  61.  
  62.  Result:  long string describing the error is returned
  63.   ----*/
  64. char *
  65. error_description(errnumber)
  66.     int errnumber;
  67. {
  68.     static char buffer[50];
  69.  
  70.     if (errnumber < 0 || errnumber > 36) 
  71.       sprintf(buffer,"Unknown error - %d - No description", errnumber);
  72.     else
  73.       strcpy(buffer, err_name[2*errnumber + 1]);
  74.  
  75.     return ( (char *) buffer);
  76. }
  77.  
  78.  
  79.